<template>
    <div class="charts">
        <!-- 容器 -->
        <div class="container" ref="baseChat"></div>
    </div>
</template>

<script>
import * as echarts from "echarts";

export default {
    //初始化echarts
    mounted() {
        let baseChart = echarts.init(this.$refs.baseChat);
        //设置图标的选项
        baseChart.setOption({
            legend: {},
            title: {
                text: "echarts折线图",
            },
            tooltip: {
                axisPointer: {
                    type: "cross",
                },
            },

            xAxis: {
                data: [
                    "1997-10-1",
                    "1997-10-2",
                    "1997-10-3",
                    "1997-10-4",
                    "1997-10-5",
                    "1997-10-6",
                ],
            },
            yAxis: {},
            series: [
                {
                    // label:{
                    //     show:true,
                    //     formotter:'{c}'
                    // },
                    name: "A相",
                    type: "line",
                    smooth: true,
                    data: [40, 20, 36, 10, 10, 20],
                },
                {
                    name: "B相",
                    type: "line",
                    smooth: true,
                    data: [10, 45, 12, 18, 32, 25],
                },
                {
                    name: "C相",
                    type: "line",
                    smooth: true,
                    data: [8, 10, 40, 15, 4, 28],
                },
            ],
        });
    },
};
</script>
<style scoped>
.charts,
.container {
    height: 300px;
}
</style>
